Developer --> Technical Publications
PATH Hardware Documentation > Device Managers and Drivers > ATA Devices > ATA Device Software Guide


ATA_RegAccess

The ATA_RegAccess function enables access to a particular device register of a selected device. This function is used for diagnostic and error recovery processes.

This call finctions properly with ATA Manager versions 3 and ATA Manager 4.1.1, and does not function properly with ATA Manager versions 4.0.0 or 4.1.0. ATA Manager 4.1.1 is part of the Mac OS 8 software release. To get the version number of the current ATA Manager, use the ATA_MgrInquiry function.

The manager function code for the ATA_RegAccess function is $12.

The parameter block associated with this function is defined below:

typedef struct /* Register access structure */
{
struct ataPBHdr /* ataPBHdr parameter block */
UInt16 RegSelect /* --> Device register */
/* selector */
union{
UInt8
byteRegValue; /* <--> Byte register value to */
/* read or to be written */
UInt16
wordRegValue; /* <--> Word register value to */
/* read or to be written */
} registerValue;
UInt16 RegMask; /* --> Mask for registers(s) */
/* to update */
devicePB xi; /* <--> Register images */
UInt8 altStatDevCntrReg; /* <--> Alternate status(R) or */
/* Device Control(W) register */
/* image */
UInt8 Reserved[3]; /* Reserved */
UInt16 Reserved[16]; /* Reserved */
} ataRegAccess;


Field descriptions

ataPBHdr
See the definition of the ataPBHdr parameter block.
RegSelect
This field specifies which one of the device registers to access. The selectors for the registers supported by the ATA_RegAccess function are listed in Table 3-3 . If RegSelect is "FFFF", then regMask describes which register(s) are to be accessed as part of a multiregister access.
RegValue
This field is either the source or destination of values for individual register accesses. For byte accesses, the upper half of the word is used. Word accesses (such as the data register) use the entire word. This field is the source or destination for the data register component of multiregister accesses.
regMask
This field is valid only if the RegSelect field contains 0xFFFF. It indicates what combination of the taskfile registers should be accessed. A bit set to one indicates either a read or a write to the register. A bit set to zero performs no operation to the register. The mask bits corresponding to the selected registers are listed in Table 3-4. Bit 0 is the least significant bit of the field.
xi
This field contains register images for Error/Features, Sector Count, Sector Number, Cylinder Low, Cylinder High, SDH, and Status/Command. Only those register images specified in the regMask field are valid. Refer to the description of the devicePB structure for the RegBlock field.
altStatDevCntrReg
For multiregister writes, this field is the source for device control writes and the destination for alternate status reads. This field is valid if the Alternate Status/Device Control Register bit in the regMask field is set to 1.

Table 3-3  ATA register selectors for regSelect field

Selector name Selector Register description
DataReg 0 Data register (16-bit access only)
ErrorReg 1 Error register (R) or features register (W)
SecCntReg 2 Sector count register
SecNumReg 3 Sector number register
CylLoReg 4 Cylinder low register
CylHiReg 5 Cylinder high register
SDHReg 6 SDH register
StatusReg
CmdReg
7 Status register (R) or command register (W)
AltStatus
DevCntr
14 Alternate status (R) or device control (W)
  0xFFFF Multi-register access (ataPBVers 2.0 or greater)


The register mask selectors are defined in Table 3-4.


Table 3-4  Register mask selectors

Mask bit Register description
0 Data register
1 Error register
2 Sector count register
3 Sector number register
4 Cylinder low register
5 Cylinder high register
6 ataTFSDH register
7 Status/command register
8-13 Reserved (set to 0)
14 Alternate status/device control register
15 Reserved (set to 0)
RESULT CODES

See Table A-1 for possible result codes returned by the ATA Manager.


© 1999 Apple Computer, Inc. — (Last Updated 30 Oct 97)

Previous | Back Up One Level | Next | Show Frames | Hide Frames